import { BasicColumn, FormSchema } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '互联方',
    dataIndex: ['connection', 'partner', 'name'],
    width: 150,
  },
  {
    title: '名称',
    dataIndex: 'name',
    width: 150,
  },
  {
    title: '函数',
    dataIndex: 'task',
    width: 150,
  },
  {
    title: '可用',
    dataIndex: 'enabled',
    width: 60,
    customRender: ({ record }) => {
      return record.enabled ? '可用' : '停用';
    },
  },
  {
    title: '分',
    dataIndex: ['crontab', 'minute'],
    width: 90,
  },
  {
    title: '时',
    dataIndex: ['crontab', 'hour'],
    width: 90,
  },
  {
    title: '天/周',
    helpMessage: '每周的第几天',
    dataIndex: ['crontab', 'day_of_week'],
    width: 90,
  },
  {
    title: '天/月',
    helpMessage: '每月的第几天',
    dataIndex: ['crontab', 'day_of_month'],
    width: 90,
  },
  {
    title: '月/年',
    helpMessage: '每年的第几月',
    dataIndex: ['crontab', 'month_of_year'],
    width: 90,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '名称',
    component: 'Input',
    colProps: { span: 8 },
  },
];
